﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace BinarySearchTree
{
    class Program
    {
        static void Main(string[] args)
        {
            

            BST<int> bat = new BST<int>();

            var nums = new int[6] { 5, 3, 6, 8, 4, 2 };
            foreach (var num in nums)
                bat.add(num);
            //bat.remove(100);
            int c = bat.maxnum();

            /////////////////
            //      5      //
            //    /   \    //
            //   3    6    //
            //  / \    \   //
            // 2  4     8  //
            /////////////////

            bat.Order();

            //bat.leveOrde();

            //Console.WriteLine(bat);


            bat = new BST<int>();
            Random random = new Random();
            for (int i = 0; i < 1000; i++)
                bat.add(random.Next(10000));
            int count = bat.Size();

            List<int> list = new List<int>();
            while (!bat.isEmpty())
                list.Add(bat.removeMin());

            ////for (int i = 1; i < list.Count; i++)
            ////    if (list[i - 1] > list[i])
            ////        Console.WriteLine(false);

            for (int i = 1; i < list.Count; i++)
                Console.WriteLine(list[i]);

        }
    }
}